import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: happyiu
 * Date: 2021-10-21
 * Time: 18:53
 */
public class TestDemo {

    public  static int fbo(int n){
        if(n==1 || n==2){
            return n;
        }
        else{
            return fbo(n-1)+fbo(n-2);
        }
    }

    public  static  int print2(int n){

        if(n<10){
            return n;
        }
        else{
            return print2(n/10)+n%10;
        }
    }


   public  static void print(int n) {
       if(n<=9) {
           System.out.print(n%10+" ");
       }
       else{
           print(n/10);
           System.out.print(n%10+" ");
       }

   }


    public static int sumAdd(int n) {

       if(n == 0) {
           return 1;
       }
       else {
           return  n+sumAdd(n-1);
       }

    }




/*    public static int math(int n)//打印水仙花数
    {
      ;
    }*/

    public static void main(String[] args) {

        Scanner scanner =new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(print2(n));
    }
}
